package csc.fresher.entity;

public enum SavingTransactionType {
	SAVING("Saving"), WITHDRAW_ALL("WithdrawAll"), WITHDRAW_INTEREST("WithdrawInterest"), REPEAT_PERIOD("RepeatPeriod");
	private final String type;

	public String getType() {
		return type;
	}

	private SavingTransactionType(String type) {
		this.type = type;
	}
	
	public static SavingTransactionType getFromType(String stringType) {
        if(stringType == null) return null;
		switch (stringType) {
        case "Saving":
            return SAVING;
        case "WithdrawAll":
            return WITHDRAW_ALL;
        case "WithdrawInterest":
        	return WITHDRAW_INTEREST;
        case "RepeatPeriod":
        	return REPEAT_PERIOD;
        default:
            return null;
        }
    }
}
